package payroll.trans;

import payroll.Employee;
import payroll.PayrollDatabase;
import payroll.Transaction;
import payroll.exception.NoSuchEmployeeException;
//超类 super class
public abstract class ChangeEmployeeTransaction implements Transaction{

    private int empId;

    public ChangeEmployeeTransaction(int empId) {
        this.empId = empId; 
    } //用构造方法 将empId 传过来
    @Override
    public void execute() {
        Employee e = PayrollDatabase.getEmployee(empId);
        if(e == null)
            throw new NoSuchEmployeeException();
        doChange(e);
    } 

    protected abstract void doChange(Employee e); 
    //抽象way 抽象类
     
    
}
